<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Property Inferences</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Property Inferences' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">knowledge</a></li><li><a href="index.html#5">Chapter 5: Modelling</a></li><li><b>Property Inferences</b></li></ul></div>
<p class="purpose">Inferences that a property of something is true, or has a particular value.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>Property inferences say that the subject has a property, which can be
either-or or valued.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inference_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">property_inf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::start</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::start</span></span>:<br/>Knowledge Module - <a href="1-km.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP10" class="function-link"><span class="function-syntax">Inferences::new_family</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"property_inf"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">, </span><span class="constant-syntax">LOG_DETAILS_INF_MTID</span><span class="plain-syntax">, </span><a href="5-pi.html#SP5" class="function-link"><span class="function-syntax">PropertyInferences::log_details</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">, </span><span class="constant-syntax">COMPARE_INF_MTID</span><span class="plain-syntax">, </span><a href="5-pi.html#SP6" class="function-link"><span class="function-syntax">PropertyInferences::cmp</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">, </span><span class="constant-syntax">EXPLAIN_CONTRADICTION_INF_MTID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="5-pi.html#SP7" class="function-link"><span class="function-syntax">PropertyInferences::explain_contradiction</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>Creation:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inferred_property</span><span class="plain-syntax">; </span><span class="comment-syntax"> property referred to</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inferred_property_value</span><span class="plain-syntax">; </span><span class="comment-syntax"> and its value, if any</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::new</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::new</span></span>:<br/><a href="5-pi.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="constant-syntax">PROTECTED_MODEL_PROCEDURE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"null property inference"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">val</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prevailing_mood</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">) </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="4-is.html#SP20" class="function-link"><span class="function-syntax">InferenceSubjects::get_default_certainty</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="5-inf.html#SP2" class="function-link"><span class="function-syntax">Inferences::create_inference</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">STORE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">data</span><span class="plain-syntax">), </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure property_inference_data is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>These in turn are used by:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::draw</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::draw</span></span>:<br/>Instances as Adjectives - <a href="2-iaa.html#SP3">&#167;3</a><br/>Either-Or Property Adjectives - <a href="3-epa.html#SP3">&#167;3</a><br/>Setting Property Relation - <a href="3-spr2.html#SP10">&#167;10</a><br/>Measurement Adjectives - <a href="3-ma.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP3" class="function-link"><span class="function-syntax">PropertyInferences::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="5-inf.html#SP8" class="function-link"><span class="function-syntax">Inferences::join_inference</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::draw_from_metadata</span><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP3" class="function-link"><span class="function-syntax">PropertyInferences::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">drawn_from_metadata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="5-inf.html#SP8" class="function-link"><span class="function-syntax">Inferences::join_inference</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::draw_negated</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::draw_negated</span></span>:<br/>Either-Or Property Adjectives - <a href="3-epa.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP3" class="function-link"><span class="function-syntax">PropertyInferences::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">certainty</span><span class="plain-syntax"> = -</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">certainty</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="5-inf.html#SP8" class="function-link"><span class="function-syntax">Inferences::join_inference</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>So now for the methods:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::log_details</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::log_details</span></span>:<br/><a href="5-pi.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"(%W)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">":=$P"</span><span class="plain-syntax">, </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>By convention, a pair of attached either/or properties which are negations of
each other &mdash; say "open" and "closed" &mdash; are treated as if they were the
same property but with different values.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::cmp</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::cmp</span></span>:<br/><a href="5-pi.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">i1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">i2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pr1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">data1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pr2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">data2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pr1</span><span class="plain-syntax">) &amp;&amp; (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr1</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">pr2</span><span class="plain-syntax">) &amp;&amp; (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr2</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">pr1</span><span class="plain-syntax"> == </span><a href="3-ep.html#SP6" class="function-link"><span class="function-syntax">EitherOrProperties::get_negation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr2</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">         (</span><span class="identifier-syntax">pr2</span><span class="plain-syntax"> == </span><a href="3-ep.html#SP6" class="function-link"><span class="function-syntax">EitherOrProperties::get_negation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr1</span><span class="plain-syntax">)))) </span><span class="identifier-syntax">pr2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pr1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP7" class="function-link"><span class="function-syntax">Inferences::measure_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr1</span><span class="plain-syntax">) - </span><a href="5-inf.html#SP7" class="function-link"><span class="function-syntax">Inferences::measure_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CI_DIFFER_IN_TOPIC</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -</span><span class="constant-syntax">CI_DIFFER_IN_TOPIC</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP7" class="function-link"><span class="function-syntax">Inferences::measure_inf</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">i1</span><span class="plain-syntax">) - </span><a href="5-inf.html#SP7" class="function-link"><span class="function-syntax">Inferences::measure_inf</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">i2</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">data1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">data2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">data1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax"> != </span><span class="identifier-syntax">data2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">) || </span><span class="comment-syntax"> i.e. if an either-or pair</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">val1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">val2</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Rvalues::compare_CONSTANT</span><span class="plain-syntax">(</span><span class="identifier-syntax">val1</span><span class="plain-syntax">, </span><span class="identifier-syntax">val2</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">M</span><span class="plain-syntax"> = </span><span class="constant-syntax">CI_DIFFER_IN_CONTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pr1</span><span class="plain-syntax">)) </span><span class="identifier-syntax">M</span><span class="plain-syntax"> = </span><span class="constant-syntax">CI_DIFFER_IN_BOOLEAN_CONTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">M</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -</span><span class="identifier-syntax">M</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CI_DIFFER_IN_COPY_ONLY</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -</span><span class="constant-syntax">CI_DIFFER_IN_COPY_ONLY</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CI_IDENTICAL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>A few properties get custom problem messages: initial value for a variable,
and properties which store the state of certain relations.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::explain_contradiction</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::explain_contradiction</span></span>:<br/><a href="5-pi.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">B</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">similarity</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">B_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">B</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"A = $I\nB = $I\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">B</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">B_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax"> == </span><span class="identifier-syntax">P_variable_initial_value</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">drawn_from_metadata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">B</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-pi.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Issue a contradiction with metadata problem</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">B</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">drawn_from_metadata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-pi.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Issue a contradiction with metadata problem</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::two_sentences_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_VariableContradiction</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this looks like a contradiction"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"because the initial value of this variable seems to be being set "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"in each of these sentences, but with a different outcome."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_value_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">B_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">binary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bp</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">                </span><a href="3-vp.html#SP8" class="function-link"><span class="function-syntax">ValueProperties::get_stored_relation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">B_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::match</span><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_relation</span><span class="plain-syntax">(3, </span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_subject</span><span class="plain-syntax">(4, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_spec</span><span class="plain-syntax">(5, </span><span class="identifier-syntax">B_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_spec</span><span class="plain-syntax">(6, </span><span class="identifier-syntax">A_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelationContradiction2</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"I'm finding a contradiction at the sentence %1, "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"because it means I can't set up %3. "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"On the one hand, %4 should relate to %5, but on the other "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"hand to %6, and this is a relation which doesn't allow "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"such clashes."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_relation</span><span class="plain-syntax">(3, </span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_subject</span><span class="plain-syntax">(4, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_spec</span><span class="plain-syntax">(5, </span><span class="identifier-syntax">B_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::quote_spec</span><span class="plain-syntax">(6, </span><span class="identifier-syntax">A_data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelationContradiction</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"I'm finding a contradiction at the sentences %1 and %2, "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"because between them they set up rival versions of %3. "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"On the one hand, %4 should relate to %5, but on the other "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"hand to %6, and this is a relation which doesn't allow "</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"such clashes."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::two_sentences_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PropertyContradiction</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this looks like a contradiction"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"because the same property seems to be being set in each of these sentences, "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"but with a different outcome."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue a contradiction with metadata problem</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">Untestable</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"this looks like a contradiction"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"because it contradicts a value set by the metadata file in the "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"materials folder for the project."</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-pi.html#SP7">&#167;7</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Access functions.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::get_property</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::get_property</span></span>:<br/><a href="5-pi.html#SP10">&#167;10</a>, <a href="5-pi.html#SP11">&#167;11</a>, <a href="5-pi.html#SP13">&#167;13</a>, <a href="5-pi.html#SP15">&#167;15</a><br/>Nonlocal Variables - <a href="2-nv.html#SP13">&#167;13</a><br/>Properties - <a href="3-prp.html#SP21">&#167;21</a><br/>Variable Subjects - <a href="4-vs.html#SP2">&#167;2</a><br/>Relation Subjects - <a href="4-rs.html#SP4">&#167;4</a><br/>Indefinite Appearance - <a href="5-ia.html#SP1">&#167;1</a>, <a href="5-ia.html#SP2">&#167;2</a><br/>The Model World - <a href="5-tmw.html#SP4_1">&#167;4.1</a>, <a href="5-tmw.html#SP4_2">&#167;4.2</a>, <a href="5-tmw.html#SP4_2_1">&#167;4.2.1</a><br/>The Naming Thicket - <a href="5-tnt.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax"> != </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::get_value</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::get_value</span></span>:<br/><a href="5-pi.html#SP13">&#167;13</a>, <a href="5-pi.html#SP15">&#167;15</a><br/>Properties - <a href="3-prp.html#SP21">&#167;21</a><br/>Variable Subjects - <a href="4-vs.html#SP2">&#167;2</a><br/>Relation Subjects - <a href="4-rs.html#SP4">&#167;4</a><br/>Indefinite Appearance - <a href="5-ia.html#SP2">&#167;2</a><br/>The Model World - <a href="5-tmw.html#SP4_2_1_1">&#167;4.2.1.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax"> != </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>The ability to set the kind looks very odd here, and it is used only to force
the initial value property to be textual for certain bibliographic data.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::set_value_kind</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::set_value_kind</span></span>:<br/>Nonlocal Variables - <a href="2-nv.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property_inference_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_property_inference_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Node::set_kind_of_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">data</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_property_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>That's everything on setting up these inferences, so the remaining functions
are for working out what properties a subject actually has, on the basis of
its inference list.
</p>

<p class="commentary">First, this returns the level of certainty that <span class="extract"><span class="extract-syntax">subj</span></span> has the either-or
property <span class="extract"><span class="extract-syntax">prn</span></span>:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::either_or_state</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::either_or_state</span></span>:<br/><a href="5-pi.html#SP12">&#167;12</a><br/>The Naming Thicket - <a href="5-tnt.html#SP7">&#167;7</a>, <a href="5-tnt.html#SP8">&#167;8</a>, <a href="5-tnt.html#SP9_1_2_2">&#167;9.1.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">subj</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">)) </span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> = </span><a href="3-ep.html#SP6" class="function-link"><span class="function-syntax">EitherOrProperties::get_negation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">subj</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><a href="4-is.html#SP11" class="function-link"><span class="function-syntax">InferenceSubjects::narrowest_broader_subject</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">k</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KNOWLEDGE_LOOP</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">known</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP3" class="function-link"><span class="function-syntax">Inferences::get_certainty</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">known</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">known</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> == </span><span class="identifier-syntax">known</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -</span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>And this is a variant which does not inherit: e.g. if the kind "bird" has
the property "flightless" but Orville, an individual instance of "bird" has no
inference about this property, then we would return <span class="extract"><span class="extract-syntax">LIKELY_CE</span></span> if asked about
"bird", but <span class="extract"><span class="extract-syntax">UNKNOWN_CE</span></span> if asked Orville. The previous function would return
<span class="extract"><span class="extract-syntax">LIKELY_CE</span></span> to both because Orville ordinarily inherits from his kind.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::either_or_state_without_inheritance</span><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> **</span><span class="identifier-syntax">where</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">subj</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">)) </span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> = </span><a href="3-ep.html#SP6" class="function-link"><span class="function-syntax">EitherOrProperties::get_negation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">KNOWLEDGE_LOOP</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">known</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP3" class="function-link"><span class="function-syntax">Inferences::get_certainty</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">known</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">known</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">where</span><span class="plain-syntax">) *</span><span class="identifier-syntax">where</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP3" class="function-link"><span class="function-syntax">Inferences::where_inferred</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prnbar</span><span class="plain-syntax"> == </span><span class="identifier-syntax">known</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">where</span><span class="plain-syntax">) *</span><span class="identifier-syntax">where</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP3" class="function-link"><span class="function-syntax">Inferences::where_inferred</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -</span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>This function does something a little unexpected, but is used only in indexing
to work out whether a property is relevant to a given subject.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::has_or_can_have</span><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-prp.html#SP16" class="function-link"><span class="function-syntax">Properties::is_either_or</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">has</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP10" class="function-link"><span class="function-syntax">PropertyInferences::either_or_state</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">has</span><span class="plain-syntax"> == </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">) &amp;&amp; (</span><a href="4-pp.html#SP2" class="function-link"><span class="function-syntax">PropertyPermissions::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RTProperties::stored_in_negation</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LIKELY_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNLIKELY_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">has</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-pp.html#SP2" class="function-link"><span class="function-syntax">PropertyPermissions::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LIKELY_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>Moving on to value properties, the following catches some late problems.
Rival values for the same property would be caught as contradictions at
assertion time in some cases, but because kinds are not always exactly known
when assertions are read, we can't yet know for sure. So later checks catch
anything falling through this crack.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PropertyInferences::verify_prop_states</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::verify_prop_states</span></span>:<br/>Inference Subjects - <a href="4-is.html#SP27">&#167;27</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">POSITIVE_KNOWLEDGE_LOOP</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_value</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PK</span><span class="plain-syntax"> = </span><a href="3-vp.html#SP6" class="function-link"><span class="function-syntax">ValueProperties::kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VK</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::to_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::compatible</span><span class="plain-syntax">(</span><span class="identifier-syntax">VK</span><span class="plain-syntax">, </span><span class="identifier-syntax">PK</span><span class="plain-syntax">) != </span><span class="identifier-syntax">ALWAYS_MATCH</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Property value given as %u not %u\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">VK</span><span class="plain-syntax">, </span><span class="identifier-syntax">PK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">inf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">inferred_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_property</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_kind</span><span class="plain-syntax">(3, </span><span class="identifier-syntax">VK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_kind</span><span class="plain-syntax">(4, </span><span class="identifier-syntax">PK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_LateInferenceProblem</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="string-syntax">"You wrote %1, but that tries to set the value of the '%2' "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"property to %3 - which must be wrong because this property "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"has to be %4."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b>And these three function calls are all variants on reading the value of
property <span class="extract"><span class="extract-syntax">prn</span></span> for subject <span class="extract"><span class="extract-syntax">subj</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::value_of</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::value_of</span></span>:<br/>The Naming Thicket - <a href="5-tnt.html#SP7">&#167;7</a>, <a href="5-tnt.html#SP9_1_4">&#167;9.1.4</a>, <a href="5-tnt.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="5-pi.html#SP15" class="function-link"><span class="function-syntax">PropertyInferences::pval_reader</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::value_and_where</span><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> **</span><span class="identifier-syntax">where</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="5-pi.html#SP15" class="function-link"><span class="function-syntax">PropertyInferences::pval_reader</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">where</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::value_and_where_without_inheritance</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::value_and_where_without_inheritance</span></span>:<br/>The Naming Thicket - <a href="5-tnt.html#SP9_1_3">&#167;9.1.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> **</span><span class="identifier-syntax">where</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="5-pi.html#SP15" class="function-link"><span class="function-syntax">PropertyInferences::pval_reader</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">where</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>All using:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">PropertyInferences::pval_reader</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">PropertyInferences::pval_reader</span></span>:<br/><a href="5-pi.html#SP14">&#167;14</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> **</span><span class="identifier-syntax">where</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">inherit</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">subj</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">subj</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">inherit</span><span class="plain-syntax">)?</span><a href="4-is.html#SP11" class="function-link"><span class="function-syntax">InferenceSubjects::narrowest_broader_subject</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">k</span><span class="plain-syntax">):</span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">POSITIVE_KNOWLEDGE_LOOP</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">known</span><span class="plain-syntax"> = </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">known</span><span class="plain-syntax"> == </span><span class="identifier-syntax">prn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">where</span><span class="plain-syntax">) *</span><span class="identifier-syntax">where</span><span class="plain-syntax"> = </span><a href="5-inf.html#SP3" class="function-link"><span class="function-syntax">Inferences::where_inferred</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="5-pi.html#SP8" class="function-link"><span class="function-syntax">PropertyInferences::get_value</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="5-inf.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-km.html">1</a></li><li class="progresschapter"><a href="2-ins.html">2</a></li><li class="progresschapter"><a href="3-prp.html">3</a></li><li class="progresschapter"><a href="4-is.html">4</a></li><li class="progresscurrentchapter">5</li><li class="progresssection"><a href="5-inf.html">inf</a></li><li class="progresscurrent">pi</li><li class="progresssection"><a href="5-ia.html">ia</a></li><li class="progresssection"><a href="5-ri.html">ri</a></li><li class="progresssection"><a href="5-tmw.html">tmw</a></li><li class="progresssection"><a href="5-tnt.html">tnt</a></li><li class="progressnext"><a href="5-ia.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

